//
//  MovieCollectionViewCell.m
//  豆瓣_精简版
//
//  Created by dllo on 15/11/7.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "MovieCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation MovieCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        [self create];
    }
    return self;
}

- (void)create{
    
    self.headImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 100, 140)];
    self.headImageView.backgroundColor = [UIColor blackColor];
    [self.contentView addSubview:self.headImageView];
    
    self.nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 150, 100, 20)];
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:self.nameLabel];
    
    
}

-(void)setMovie:(Movie *)movie{
    
    if (_movie != movie) {
        [_movie release];
        _movie = [movie retain];
    }
    self.nameLabel.text = movie.movieName;
    NSURL *url = [NSURL URLWithString:movie.pic_url];
    [self.headImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeHoderImage.png"]];
    
}


@end
